package com.project.myPackage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.myPackage.entity.Favorites;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface FavoritesMapper extends BaseMapper<Favorites> {
    //关联商品表
    @Select("SELECT favorites.*, products.* " +
            "FROM favorites " +
            "LEFT JOIN products ON favorites.product_id = products.product_id " +
            "WHERE favorites.user_id = #{user_id} and products.status=1")
    List<Map<String, Object>> getList(Integer user_id);
}
